package com.yicong.ants.view.dialog;

import android.content.Context;

import com.cchao.simplelib.core.UiHelper;
import com.yicong.ants.R;
import com.yicong.ants.utils.DisplayUtils;

/**
 * 打开定位信息
 *
 * @author LinDingQiang
 * @description
 * @time 4/17/21 9:51 PM
 * @email dingqiang.l
 */
public class GpsDialog extends BaseNiceDialog {
    CallBack mListener;

    public static GpsDialog newInstance(Context context) {
        GpsDialog dialog = new GpsDialog();
        dialog.setWidth(DisplayUtils.px2dp(context, (float) (UiHelper.getScreenWidth() * 0.7)))
            .setOutCancel(true)
            .setDimAmount(0.3f);
        return dialog;
    }

    public GpsDialog setConvertListener(CallBack listener) {
        this.mListener = listener;
        return this;
    }

    @Override
    public int intLayoutId() {
        return R.layout.dialog_gps;
    }

    @Override
    public void convertView(NiceViewHolder holder, BaseNiceDialog dialog) {
        holder.setOnClickListener(R.id.bt_cancel, v -> dismiss())
            .setOnClickListener(R.id.bt_confirm, v -> {
                dismiss();
                mListener.onClick();
            });
    }

    public interface CallBack {
        void onClick();
    }
}
